package org.sunsys.spring.rest.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.sunsys.spring.rest.model.Fruit;

@Controller
public class FruitController {

	
	@RequestMapping(value="/fruitservice/fruit/{fruitName}", method={RequestMethod.GET, RequestMethod.POST})
	public String frootDetails(@PathVariable String fruitName, Model model) {
		System.out.println("Fruit vale:"+fruitName);
		Fruit fruit = new Fruit();
		fruit.setName(fruitName);
		fruit.setQuality(10);
		
		model.addAttribute(fruit);
		
		return "/list";
	}

}
